package com.bawei.andfix;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;

import java.io.File;

public class MainActivity extends AppCompatActivity {
    private static final String FILE_END = ".apatch";
    private String mPathDir;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mPathDir = getExternalCacheDir().getAbsolutePath()+"/apatch/";
        File file = new File(mPathDir);
        if(file == null || file.exists()){
            file.mkdir();
        }

    }

    //制作bug
    public void log(View view) {
        LogUtils.printLog();
    }
    //修复
    public void repair(View view) {
        AndFixPatchManager.getInstance().addPatch(getPatchName());
    }
    private String getPatchName(){
        return mPathDir.concat("bawei").concat(FILE_END);
    }
}